<!-- /* Description for file.
 * 公司共享文档
 * @copyright     Copyright 2008-2010, PHInfo Services Inc. (http://www.phinfoservices.com)
 * @package       ues
 * @subpackage    ues/app/views/filecompanyshares
 * @since         ues
 * @version       V0.0.1
 * @modifiedby    张海杰2011年0629
 * @lastmodified  张海杰2011年0629
 */
 -->
 <?php
echo $html->css ( 'style' );
echo $html->css ( 'tab' );
echo $javascript->link ( 'jquery' );

?>
<script type="text/javascript">
	function getDelStr() {
		var delArr = $("#FilecompanyshareDeleteSomeForm :checkbox:checked");
		if(delArr.length==0)
		{
			alert("请选择你要删除的项!");
			return;
		}
		if(!confirm("确定删除?"))
		{
			return;
		}
		var str = "";
		for(var i=0;i<delArr.length;i++) {
			var del = delArr[i].value;
			str += del;
			str += "/";
		}
		$("#delStr").val(str);
		$("#FilecompanyshareDeleteSomeForm").submit();
	}

	$(document).ready(function(){
		$("#cancel").click(function(){
			$(".toolbarStyle").toggle(); 
			});
		$("#btnajaxEdit").click(function(){
			var delArr = $("#FilecompanyshareDeleteSomeForm :checkbox:checked");
			if(delArr.length==0)
			{
				alert("请选择你要修改存放目录的项!");
				return;
			}
			var str = "";
			for(var i=0;i<delArr.length;i++) {
				var id = delArr[i].value;
				str += id;
				str += "/";
			}
			$("#IdStr").val(str);//得到需要修改存放目录的文件的ID串
			$(".toolbarStyle").toggle();
			});
	});
</script>

<!-- 当前位置-->
<div id="tabmenubar">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td class="tabmenubartitle1"><?php echo  __('YourPosition');//您现在的位置：?></td>
		<td class="tabmenubartitle2"><?php echo __('Personal Office');//一级目录
										   echo '>';?>
									<?php echo $html->tag('span', __('Filecompanyshares',true));//当前操作地用span加粗?> 						  
		</td>
	</tr>
</table>
</div>
<!-- 当前位置-->
<div class="tabflex">
<table width="50%" cellspacing="0" cellpadding="0" border="0">
	<tr>
		<td width="100px">
		 <input type="button" onclick="location.href='<?php echo ROOT_WEB_PATH; ?>/filecompanyshares/addfileinit/'" class="btn4" value="上传文档" />
		</td><!--  __('Add', true) 上传文档-->
		<?php if($Acl->check(array('model' => 'User', 'foreign_key' => $userinfo['User']['id']), "Filecompanyshares/deleteSome"))
    	 	{ 
     		echo "<td width='100px'><input type='button' onclick='getDelStr()' class='btn4' value='删除文档' /></td>";
      		}	
  	 	?><!--  __('delete', true) 删除、提示      无权限整个td隐藏-->
		<td width="100px">
			<input type="button" id="btnajaxEdit" class="btn6" value="修改存放目录" />
		</td>
			<!--  __('edit', true) 修改存放目录 -->
		<td>
       </td>		
	</tr>
</table>
</div>

<!--修改存放目录iframe-->
<div class="toolbarStyle" style="display:none">
<?php echo $form->create('Filecompanyshare',array('action'=>'edit','type'=> 'post'));?>
<?php echo $form->hidden('idStr',array('name'=>'filecompanysharesid','id'=>'IdStr'));?>
<?php //echo $form->hidden('fold',array('name'=>'foldid','id'=>'fold'));?>
<table width="100%"  height="90px" cellspacing="0" cellpadding="0" border="0" style="text-align: left">
	<tr>
		<td width="50"></td>
		<td width="100"><?php __('FilepersonalSelectFather');//选择父目录?>:</td>
		<td><?php $options = array();
				foreach($folds as $eachrecord)
								{					
									$options[$eachrecord['Filecompanyshare']['id']] = $eachrecord['Filecompanyshare']['fileName'];
								}
								echo $form->input('fatherId',array('name'=>'foldid','options'=>$options,'label'=>false,'div'=>false,'class'=>'TextBoxE1','empty' =>'--','id'=>'fatherId'));					
					//下拉菜单?>
		</td>
	</tr>
	<tr><td colspan="2"></td><td><font color="gray">*只能修改文档的存放目录</font></td></tr>		
</table>
<table width="100%" cellspacing="0" cellpadding="0" border="0" style="text-align: left">
	<tr>
		<td width="50"></td>
		<td width="100"><?php echo $form->button('关闭',array('type'=>'button','class'=>'cancelbutton','id'=>'cancel'));?>  <!-- __('reset', true)重置-->
		</td>
		<td width="100"><?php echo $form->button('确定',array('type'=>'submit','class'=>'oksubmit','id'=>'btnajaxSave'));?> 
		</td>
	</tr>
</table>
<?php echo $form->end();?>	
</div>
<!--修改存放目录iframe-->


<?php echo $form->create('Filecompanyshare',array('action'=>'deleteSome','type'=> 'post'));?>
<?php echo $form->hidden('delStr',array('name'=>'filecompanysharesid','id'=>'delStr'));?>
<!-- 公司共享文档列表 -->
<div id="nav1">
<table width="100%" cellpadding="0" cellspacing="0" class="tab1">
	<tr>
		<th width="70px"><?php echo __('Selected');?></th>		
		<th ><?php echo __('FilepersonalName');//名称?></th>
		<th ><?php echo __('FilepersonalSpecification');//说明?></th>
		<th ><?php echo __('FilepersonalType');//类型?></th>
		<th ><?php echo __('FilepersonalUploadTime');//添加时间?></th>
		<th ><?php echo __('FilepersonalUploadPerson');//添加人?></th>
	</tr>
	<!-- Here's where we loop through our $Notes array, printing out post info --> 
	
	<?php 
	foreach ($filecompanyshares as $data): 
	?>
		<tr class=normal onmouseover='this.className= "over " '
			onmouseup='this.className= "over " '
			onmouseout='this.className= "normal " '>
			<td>
<!-- 批量删除选择 -->				
				<?php echo $form->checkbox($data['Filecompanyshare']['id'], array('value' => $data['Filecompanyshare']['id']));?>
			</td>
			<td title="<?php echo $data['Filecompanyshare']['fileName']; ?>">
<!-- 是文件夹进入下一级别，否则下载文件 -->			
			<?php 
			if($data['Filecompanyshare']['type']=='Fold'){
				echo $html->link($data['Filecompanyshare']['fileName'],
					'/filecompanyshares/index/'. $data['Filecompanyshare']['id']); 
			}
			else {
				$file=array();
				$file=explode("\\",$data['Filecompanyshare']['filePath']);
				//print_r($file);
				$dir="";
				for($i=0;$i<count($file)-1;$i++)
				{
					$dir=$dir.$file[$i]."-";
				}
				$dir=substr($dir,0,strlen($dir)-1);
				echo $html->link($data['Filecompanyshare']['fileName'],
					'/filepersonals/down/'.$dir.'/'.$file[count($file)-1]);
			} 
			?>
			</td>
			<td title="<?php echo $data['Filecompanyshare']['fileSpecification']; ?>"><?php echo $data['Filecompanyshare']['fileSpecification']; ?></td>
			<td title="<?php echo $data['Filecompanyshare']['type']; ?>"><?php echo $data['Filecompanyshare']['type']; ?></td>
			<td title="<?php echo $data['Filecompanyshare']['created']; ?>"><?php echo $data['Filecompanyshare']['created']; ?></td>
			<td title="<?php echo $data['Filecompanyshare']['uploadPerson']; ?>"><?php echo $data['Filecompanyshare']['uploadPerson']; ?></td>			
		</tr> 
	<?php endforeach; ?>
</table>
</div>
<!-- 公司共享文档列表 -->
<?php echo $form->end();?>
